/*
'===============================================================================
'  Generated From - CSharp_EasyObject_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL      = SQL_DAAB_StoredProcs.vbgen
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easily done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using System.IO;

using Microsoft.Practices.EnterpriseLibrary.Data;
using NCI.EasyObjects;

namespace CMS.DAL
{

	#region Schema

	public class TourDestinationSchema : NCI.EasyObjects.Schema
	{
		private static ArrayList _entries;
		public static SchemaItem TourDestinationID = new SchemaItem("TourDestinationID", DbType.Int32, true, false, false, true, false, false);
		public static SchemaItem TourDestinationTitle1 = new SchemaItem("TourDestinationTitle1", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem TourDestinationTitle2 = new SchemaItem("TourDestinationTitle2", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem TourDestinationTitle3 = new SchemaItem("TourDestinationTitle3", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);
		public static SchemaItem TourDestinationDetail1 = new SchemaItem("TourDestinationDetail1", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem TourDestinationDetail2 = new SchemaItem("TourDestinationDetail2", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem TourDestinationDetail3 = new SchemaItem("TourDestinationDetail3", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem RegionID = new SchemaItem("RegionID", DbType.Int32, false, true, false, false, false, false);
		public static SchemaItem Image = new SchemaItem("Image", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);

		public override ArrayList SchemaEntries
		{
			get
			{
				if (_entries == null )
				{
					_entries = new ArrayList();
					_entries.Add(TourDestinationSchema.TourDestinationID);
					_entries.Add(TourDestinationSchema.TourDestinationTitle1);
					_entries.Add(TourDestinationSchema.TourDestinationTitle2);
					_entries.Add(TourDestinationSchema.TourDestinationTitle3);
					_entries.Add(TourDestinationSchema.TourDestinationDetail1);
					_entries.Add(TourDestinationSchema.TourDestinationDetail2);
					_entries.Add(TourDestinationSchema.TourDestinationDetail3);
					_entries.Add(TourDestinationSchema.RegionID);
					_entries.Add(TourDestinationSchema.Image);
				}
				return _entries;
			}
		}
		
		public static bool HasAutoKey 
		{
			get { return true;	}
		}

		public static bool HasRowID 
		{
			get { return false;	}
		}
	}
	#endregion

	public abstract class _TourDestination : EasyObject
	{

		public _TourDestination()
		{
			TourDestinationSchema _schema = new TourDestinationSchema();
			this.SchemaEntries = _schema.SchemaEntries;
			this.SchemaGlobal = "dbo";
		}
		
		public override void FlushData() 	 
		{ 	 
			this._whereClause = null; 	 
			this._aggregateClause = null; 	 
			base.FlushData(); 	 
		}
			   
		/// <summary>
		/// Loads the business object with info from the database, based on the requested primary key.
		/// </summary>
		/// <param name="TourDestinationID"></param>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadByPrimaryKey(int TourDestinationID)
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					ListDictionary parameters = new ListDictionary();

					// Add in parameters
					parameters.Add(TourDestinationSchema.TourDestinationID.FieldName, TourDestinationID);

					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetTourDestination", parameters, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.TourDestinationID.Value = TourDestinationID;
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}
	
		/// <summary>
		/// Loads all records from the table.
		/// </summary>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadAll()
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetAllTourDestination", null, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		/// <summary>
		/// Adds a new record to the internal table.
		/// </summary>
		public override void AddNew()
		{
			base.AddNew();
			this.ApplyDefaults();
		}

		/// <summary>
		/// Apply any default values to columns
		/// </summary>
		protected override void ApplyDefaults()
		{
		}

		protected override DbCommand GetInsertCommand(CommandType commandType)
		{	
			DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_AddTourDestination";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddParameter(dbCommand, "TourDestinationID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "TourDestinationID", DataRowVersion.Default, Convert.DBNull);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!item.IsComputed)
						{
							if ((item.IsAutoKey && this.IdentityInsert) || !item.IsAutoKey)
							{
								this.Query.AddInsertColumn(item);
							}
						}
					}
					dbCommand = this.Query.GetInsertCommandWrapper();

					dbCommand.Parameters.Clear();
					if (this.IdentityInsert)
					{
						db.AddInParameter(dbCommand, "TourDestinationID", DbType.Int32, "TourDestinationID", DataRowVersion.Default);
					}
					else
					{
						db.AddParameter(dbCommand, "TourDestinationID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "TourDestinationID", DataRowVersion.Default, Convert.DBNull);
					}
					CreateParameters(db, dbCommand);

					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetUpdateCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_UpdateTourDestination";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddInParameter(dbCommand, "TourDestinationID", DbType.Int32, "TourDestinationID", DataRowVersion.Current);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!(item.IsAutoKey || item.IsComputed))
						{
							this.Query.AddUpdateColumn(item);
						}
					}

					this.Where.WhereClauseReset();
					this.Where.TourDestinationID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetUpdateCommandWrapper();

					dbCommand.Parameters.Clear();
					CreateParameters(db, dbCommand);
					db.AddInParameter(dbCommand, "TourDestinationID", DbType.Int32, "TourDestinationID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetDeleteCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_DeleteTourDestination";
					dbCommand = db.GetStoredProcCommand(sqlCommand);
					db.AddInParameter(dbCommand, "TourDestinationID", DbType.Int32, "TourDestinationID", DataRowVersion.Current);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.TourDestinationID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetDeleteCommandWrapper();

					dbCommand.Parameters.Clear();
					db.AddInParameter(dbCommand, "TourDestinationID", DbType.Int32, "TourDestinationID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		private void CreateParameters(Database db, DbCommand dbCommand)
		{
			db.AddInParameter(dbCommand, "TourDestinationTitle1", DbType.String, "TourDestinationTitle1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourDestinationTitle2", DbType.String, "TourDestinationTitle2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourDestinationTitle3", DbType.String, "TourDestinationTitle3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourDestinationDetail1", DbType.String, "TourDestinationDetail1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourDestinationDetail2", DbType.String, "TourDestinationDetail2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "TourDestinationDetail3", DbType.String, "TourDestinationDetail3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "RegionID", DbType.Int32, "RegionID", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Image", DbType.String, "Image", DataRowVersion.Current);
		}
		
		#region Properties
		public virtual int TourDestinationID
		{
			get
			{
				return this.GetInteger(TourDestinationSchema.TourDestinationID.FieldName);
	    	}
			set
			{
				this.SetInteger(TourDestinationSchema.TourDestinationID.FieldName, value);
			}
		}
		public virtual string TourDestinationTitle1
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationTitle1.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationTitle1.FieldName, value);
			}
		}
		public virtual string TourDestinationTitle2
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationTitle2.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationTitle2.FieldName, value);
			}
		}
		public virtual string TourDestinationTitle3
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationTitle3.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationTitle3.FieldName, value);
			}
		}
		public virtual string TourDestinationDetail1
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationDetail1.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationDetail1.FieldName, value);
			}
		}
		public virtual string TourDestinationDetail2
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationDetail2.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationDetail2.FieldName, value);
			}
		}
		public virtual string TourDestinationDetail3
		{
			get
			{
				return this.GetString(TourDestinationSchema.TourDestinationDetail3.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.TourDestinationDetail3.FieldName, value);
			}
		}
		public virtual int RegionID
		{
			get
			{
				return this.GetInteger(TourDestinationSchema.RegionID.FieldName);
	    	}
			set
			{
				this.SetInteger(TourDestinationSchema.RegionID.FieldName, value);
			}
		}
		public virtual string Image
		{
			get
			{
				return this.GetString(TourDestinationSchema.Image.FieldName);
	    	}
			set
			{
				this.SetString(TourDestinationSchema.Image.FieldName, value);
			}
		}

		public override string TableName
		{
			get { return "TourDestination"; }
		}
		
		#endregion		
		
		#region String Properties
		public virtual string s_TourDestinationID
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationID.FieldName) ? string.Empty : base.GetIntegerAsString(TourDestinationSchema.TourDestinationID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationID.FieldName);
			    else
			        this.TourDestinationID = base.SetIntegerAsString(TourDestinationSchema.TourDestinationID.FieldName, value);
			}
		}
		public virtual string s_TourDestinationTitle1
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationTitle1.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationTitle1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationTitle1.FieldName);
			    else
			        this.TourDestinationTitle1 = base.SetStringAsString(TourDestinationSchema.TourDestinationTitle1.FieldName, value);
			}
		}
		public virtual string s_TourDestinationTitle2
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationTitle2.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationTitle2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationTitle2.FieldName);
			    else
			        this.TourDestinationTitle2 = base.SetStringAsString(TourDestinationSchema.TourDestinationTitle2.FieldName, value);
			}
		}
		public virtual string s_TourDestinationTitle3
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationTitle3.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationTitle3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationTitle3.FieldName);
			    else
			        this.TourDestinationTitle3 = base.SetStringAsString(TourDestinationSchema.TourDestinationTitle3.FieldName, value);
			}
		}
		public virtual string s_TourDestinationDetail1
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationDetail1.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationDetail1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationDetail1.FieldName);
			    else
			        this.TourDestinationDetail1 = base.SetStringAsString(TourDestinationSchema.TourDestinationDetail1.FieldName, value);
			}
		}
		public virtual string s_TourDestinationDetail2
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationDetail2.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationDetail2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationDetail2.FieldName);
			    else
			        this.TourDestinationDetail2 = base.SetStringAsString(TourDestinationSchema.TourDestinationDetail2.FieldName, value);
			}
		}
		public virtual string s_TourDestinationDetail3
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.TourDestinationDetail3.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.TourDestinationDetail3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.TourDestinationDetail3.FieldName);
			    else
			        this.TourDestinationDetail3 = base.SetStringAsString(TourDestinationSchema.TourDestinationDetail3.FieldName, value);
			}
		}
		public virtual string s_RegionID
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.RegionID.FieldName) ? string.Empty : base.GetIntegerAsString(TourDestinationSchema.RegionID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.RegionID.FieldName);
			    else
			        this.RegionID = base.SetIntegerAsString(TourDestinationSchema.RegionID.FieldName, value);
			}
		}
		public virtual string s_Image
		{
			get
			{
			    return this.IsColumnNull(TourDestinationSchema.Image.FieldName) ? string.Empty : base.GetStringAsString(TourDestinationSchema.Image.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(TourDestinationSchema.Image.FieldName);
			    else
			        this.Image = base.SetStringAsString(TourDestinationSchema.Image.FieldName, value);
			}
		}
		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter TourDestinationID
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationTitle1
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationTitle1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationTitle2
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationTitle2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationTitle3
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationTitle3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationDetail1
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationDetail1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationDetail2
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationDetail2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter TourDestinationDetail3
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.TourDestinationDetail3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter RegionID
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.RegionID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Image
				{
					get
					{
							WhereParameter wp = new WhereParameter(TourDestinationSchema.Image);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter TourDestinationID
		    {
				get
		        {
					if(_TourDestinationID_W == null)
	        	    {
						_TourDestinationID_W = TearOff.TourDestinationID;
					}
					return _TourDestinationID_W;
				}
			}

			public WhereParameter TourDestinationTitle1
		    {
				get
		        {
					if(_TourDestinationTitle1_W == null)
	        	    {
						_TourDestinationTitle1_W = TearOff.TourDestinationTitle1;
					}
					return _TourDestinationTitle1_W;
				}
			}

			public WhereParameter TourDestinationTitle2
		    {
				get
		        {
					if(_TourDestinationTitle2_W == null)
	        	    {
						_TourDestinationTitle2_W = TearOff.TourDestinationTitle2;
					}
					return _TourDestinationTitle2_W;
				}
			}

			public WhereParameter TourDestinationTitle3
		    {
				get
		        {
					if(_TourDestinationTitle3_W == null)
	        	    {
						_TourDestinationTitle3_W = TearOff.TourDestinationTitle3;
					}
					return _TourDestinationTitle3_W;
				}
			}

			public WhereParameter TourDestinationDetail1
		    {
				get
		        {
					if(_TourDestinationDetail1_W == null)
	        	    {
						_TourDestinationDetail1_W = TearOff.TourDestinationDetail1;
					}
					return _TourDestinationDetail1_W;
				}
			}

			public WhereParameter TourDestinationDetail2
		    {
				get
		        {
					if(_TourDestinationDetail2_W == null)
	        	    {
						_TourDestinationDetail2_W = TearOff.TourDestinationDetail2;
					}
					return _TourDestinationDetail2_W;
				}
			}

			public WhereParameter TourDestinationDetail3
		    {
				get
		        {
					if(_TourDestinationDetail3_W == null)
	        	    {
						_TourDestinationDetail3_W = TearOff.TourDestinationDetail3;
					}
					return _TourDestinationDetail3_W;
				}
			}

			public WhereParameter RegionID
		    {
				get
		        {
					if(_RegionID_W == null)
	        	    {
						_RegionID_W = TearOff.RegionID;
					}
					return _RegionID_W;
				}
			}

			public WhereParameter Image
		    {
				get
		        {
					if(_Image_W == null)
	        	    {
						_Image_W = TearOff.Image;
					}
					return _Image_W;
				}
			}

			private WhereParameter _TourDestinationID_W = null;
			private WhereParameter _TourDestinationTitle1_W = null;
			private WhereParameter _TourDestinationTitle2_W = null;
			private WhereParameter _TourDestinationTitle3_W = null;
			private WhereParameter _TourDestinationDetail1_W = null;
			private WhereParameter _TourDestinationDetail2_W = null;
			private WhereParameter _TourDestinationDetail3_W = null;
			private WhereParameter _RegionID_W = null;
			private WhereParameter _Image_W = null;

			public void WhereClauseReset()
			{
				_TourDestinationID_W = null;
				_TourDestinationTitle1_W = null;
				_TourDestinationTitle2_W = null;
				_TourDestinationTitle3_W = null;
				_TourDestinationDetail1_W = null;
				_TourDestinationDetail2_W = null;
				_TourDestinationDetail3_W = null;
				_RegionID_W = null;
				_Image_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private EasyObject _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
		
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter TourDestinationID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationTitle1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationTitle1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationTitle2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationTitle2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationTitle3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationTitle3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationDetail1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationDetail1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationDetail2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationDetail2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter TourDestinationDetail3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.TourDestinationDetail3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter RegionID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.RegionID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Image
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(TourDestinationSchema.Image);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter TourDestinationID
		    {
				get
		        {
					if(_TourDestinationID_W == null)
	        	    {
						_TourDestinationID_W = TearOff.TourDestinationID;
					}
					return _TourDestinationID_W;
				}
			}

			public AggregateParameter TourDestinationTitle1
		    {
				get
		        {
					if(_TourDestinationTitle1_W == null)
	        	    {
						_TourDestinationTitle1_W = TearOff.TourDestinationTitle1;
					}
					return _TourDestinationTitle1_W;
				}
			}

			public AggregateParameter TourDestinationTitle2
		    {
				get
		        {
					if(_TourDestinationTitle2_W == null)
	        	    {
						_TourDestinationTitle2_W = TearOff.TourDestinationTitle2;
					}
					return _TourDestinationTitle2_W;
				}
			}

			public AggregateParameter TourDestinationTitle3
		    {
				get
		        {
					if(_TourDestinationTitle3_W == null)
	        	    {
						_TourDestinationTitle3_W = TearOff.TourDestinationTitle3;
					}
					return _TourDestinationTitle3_W;
				}
			}

			public AggregateParameter TourDestinationDetail1
		    {
				get
		        {
					if(_TourDestinationDetail1_W == null)
	        	    {
						_TourDestinationDetail1_W = TearOff.TourDestinationDetail1;
					}
					return _TourDestinationDetail1_W;
				}
			}

			public AggregateParameter TourDestinationDetail2
		    {
				get
		        {
					if(_TourDestinationDetail2_W == null)
	        	    {
						_TourDestinationDetail2_W = TearOff.TourDestinationDetail2;
					}
					return _TourDestinationDetail2_W;
				}
			}

			public AggregateParameter TourDestinationDetail3
		    {
				get
		        {
					if(_TourDestinationDetail3_W == null)
	        	    {
						_TourDestinationDetail3_W = TearOff.TourDestinationDetail3;
					}
					return _TourDestinationDetail3_W;
				}
			}

			public AggregateParameter RegionID
		    {
				get
		        {
					if(_RegionID_W == null)
	        	    {
						_RegionID_W = TearOff.RegionID;
					}
					return _RegionID_W;
				}
			}

			public AggregateParameter Image
		    {
				get
		        {
					if(_Image_W == null)
	        	    {
						_Image_W = TearOff.Image;
					}
					return _Image_W;
				}
			}

			private AggregateParameter _TourDestinationID_W = null;
			private AggregateParameter _TourDestinationTitle1_W = null;
			private AggregateParameter _TourDestinationTitle2_W = null;
			private AggregateParameter _TourDestinationTitle3_W = null;
			private AggregateParameter _TourDestinationDetail1_W = null;
			private AggregateParameter _TourDestinationDetail2_W = null;
			private AggregateParameter _TourDestinationDetail3_W = null;
			private AggregateParameter _RegionID_W = null;
			private AggregateParameter _Image_W = null;

			public void AggregateClauseReset()
			{
				_TourDestinationID_W = null;
				_TourDestinationTitle1_W = null;
				_TourDestinationTitle2_W = null;
				_TourDestinationTitle3_W = null;
				_TourDestinationDetail1_W = null;
				_TourDestinationDetail2_W = null;
				_TourDestinationDetail3_W = null;
				_RegionID_W = null;
				_Image_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private EasyObject _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	}
}
